package com.haohan.jingyuan.user.helper;

import com.haohan.jingyuan.user.dto.resp.RoleInfoResp;
import com.haohan.jingyuan.user.entity.RoleInfo;

/**
 * RoleInfoRespHelper
 */
public class RoleInfoRespHelper {

    /**
     * convertToRoleInfoResp
     */
    public static RoleInfoResp convertToRoleInfoResp(RoleInfo roleInfo) {
        if (roleInfo == null) {
            return null;
        }

        RoleInfoResp roleInfoResp = new RoleInfoResp();
        roleInfoResp.setId(roleInfo.getId());
        roleInfoResp.setRoleId(roleInfo.getRoleId());
        roleInfoResp.setRoleName(roleInfo.getRoleName());
        roleInfoResp.setRoleStatus(roleInfo.getRoleStatus());
        roleInfoResp.setRoleResources(roleInfo.getRoleResources());
        roleInfoResp.setCreator(roleInfo.getCreator());
        roleInfoResp.setGmtCreated(roleInfo.getGmtCreated() != null ? roleInfo.getGmtCreated() : null);
        roleInfoResp.setModifier(roleInfo.getModifier());
        roleInfoResp.setGmtModified(roleInfo.getGmtModified() != null ? roleInfo.getGmtModified() : null);
        roleInfoResp.setIsDeleted(roleInfo.getIsDeleted());

        return roleInfoResp;
    }
}